﻿<Window x:Class="EpiInfoWebSecurity.MainWindow" Title="Window1" Height="750" MinWidth="395" Width="994.627" Icon="/EpiInfoWebSecurity;component/App.ico" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Window.Resources>
        <Style x:Key="ManageSecuityGrpBox" TargetType="GroupBox">
            <Setter Property="Background" Value="#e1eef4 "/>
            <Setter Property="FontFamily" Value="Calibri, Global User Interface" />
            <Setter Property="FontSize" Value="15" />
            <Setter Property="Foreground" Value="#333333" />
            <Setter Property="BorderBrush" Value="#4d74a4" />
        </Style>
        <Style TargetType="Label">
            <Setter Property="Padding" Value="0 0 0 3" />
        </Style>
        <Style x:Key="EncryptionDecryptionGrpBox" TargetType="GroupBox">
            <Setter Property="Background" Value="#e1eef4"/>
            <Setter Property="FontFamily" Value="Calibri, Global User Interface" />
            <Setter Property="FontSize" Value="15" />
            <Setter Property="Foreground" Value="#333333" />
            <Setter Property="BorderBrush" Value="#4d74a4" />
        </Style>

        <Style TargetType="Button">
            <Setter Property="Background" Value="#5c53ac " />
            <Setter Property="Height" Value="25" />
            <Setter Property="FontSize" Value="12" />

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Background="{TemplateBinding Background}" x:Name="Border" CornerRadius="0" BorderThickness="0" BorderBrush="{x:Static SystemColors.ControlDarkDarkBrush}">
                            <ContentPresenter  Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsDefaulted" Value="True">
                                <Setter TargetName="Border" Property="BorderBrush" Value="#1f3b53" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#1f3b53" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Border" Property="Background" Value="#39346b" />
                                <Setter Property="Background" Value="#39346b" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#1f3b53" />
                                <Setter Property="Cursor" Value="Hand" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="Border" Property="Background" Value="#5c53ac" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#1f3b53" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Border" Property="Background" Value="#c1c1c1" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#a1a1a1" />
                                <Setter Property="Foreground" Value="#7a7a7a" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="True">
                                <Setter TargetName="Border" Property="Background" Value="#5c53ac" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#1f3b53" />
                                <Setter Property="Foreground" Value="White" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <Style TargetType="TextBox">
            <Setter Property="Background" Value="White" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="BorderBrush" Value="#aaaaaa" />
        </Style>
        <!--Scrollbar Thumbs-->
        <Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Grid x:Name="Grid">
                            <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent" />
                            <Border x:Name="Rectangle1" CornerRadius="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto"  Background="{TemplateBinding Background}" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="Tag" Value="Horizontal">
                                <Setter TargetName="Rectangle1" Property="Width" Value="Auto" />
                                <Setter TargetName="Rectangle1" Property="Height" Value="7" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--ScrollBars-->
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
            <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
            <Setter Property="Foreground" Value="#d6d6d6" />
            <Setter Property="Background" Value="#F7F7F7" />
            <Setter Property="Width" Value="9" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                        <Grid x:Name="GridRoot" Width="9" Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="0.00001*" />
                            </Grid.RowDefinitions>

                            <Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true" Focusable="false">
                                <Track.Thumb>
                                    <Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}" />
                                </Track.Thumb>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="false" />
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="false" />
                                </Track.DecreaseRepeatButton>
                            </Track>
                        </Grid>

                        <ControlTemplate.Triggers>
                            <Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
                                <Setter Value="{DynamicResource ButtonSelectBrush}" TargetName="Thumb" Property="Background" />
                            </Trigger>
                            <Trigger SourceName="Thumb" Property="IsDragging" Value="true">
                                <Setter Value="{DynamicResource DarkBrush}" TargetName="Thumb" Property="Background" />
                            </Trigger>

                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="Thumb" Property="Visibility" Value="Collapsed" />
                            </Trigger>
                            <Trigger Property="Orientation" Value="Horizontal">
                                <Setter TargetName="GridRoot" Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="-90" />
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="PART_Track" Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="-90" />
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Width" Value="Auto" />
                                <Setter Property="Height" Value="8" />
                                <Setter TargetName="Thumb" Property="Tag" Value="Horizontal" />
                                <Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
                                <Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>


    <DockPanel>
        <StackPanel DockPanel.Dock="Top" Height="60" Background="Transparent">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="256" />
                    <ColumnDefinition  />
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Left" Margin="30,1,0,0" Width="225">
                    <Image.Source>
                        <BitmapImage UriSource="/Images/epi_info_headaer_logo.png" />
                    </Image.Source>
                </Image>
                <TextBlock FontFamily="Segoe UI Tahoma,Geneva,Verdana,sans-serif" Foreground="#1D60AC" FontSize="40" FontWeight="Normal" Margin="255,7,145,3" Grid.ColumnSpan="2">web security</TextBlock>
            </Grid>
        </StackPanel>

        <ScrollViewer DockPanel.Dock="Bottom" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <StackPanel>
                <StackPanel>
                    <GroupBox Style="{StaticResource ManageSecuityGrpBox}" Height="Auto" Padding="0 0 0 0" Margin="28,10,24,0">
                        <GroupBox.Header>
                            <Label Foreground="#333333" FontSize="18" FontWeight="Bold" Content="Manage Security Keys"/>
                        </GroupBox.Header>
                        <!--<Grid Width="933">-->
                        <StackPanel x:Name="grdManageKeys" Margin="13,10,13, 10"  Visibility="Visible">
                            <StackPanel>
                                <Label Content="Web.config file path" x:Name="label7" VerticalAlignment="Top" HorizontalAlignment="Left" Width="163"  />
                                <Grid >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="85" />
                                    </Grid.ColumnDefinitions>
                                    <TextBox Grid.Column="0" IsEnabled="false" x:Name="path" TextWrapping="Wrap" />
                                    <Button  Grid.Column="1"  Margin="15 0 0 0" HorizontalAlignment="Left" Click="Button_Click">
                                        File Browser
                                        <Button.ToolTip>
                                            <TextBlock>Find Web.config file</TextBlock>
                                        </Button.ToolTip>
                                        <!--<Button.Content>
                                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="40" Height="25" Margin="0">
                                                <TextBlock.Background>
                                                    <StaticResource ResourceKey="folderImage"/>
                                                    
                                                </TextBlock.Background>
                                                <TextBlock.ToolTip>
                                                    <TextBlock>Get Web.config file</TextBlock>
                                                </TextBlock.ToolTip> 
                                            </TextBlock>
                                        </Button.Content>-->
                                    </Button>

                                </Grid>
                            </StackPanel>

                            <WrapPanel Orientation="Horizontal" Margin="0 10 0 0">
                                <StackPanel Margin="0 0 15 15">
                                    <Label x:Name="label6" Content="Vector" HorizontalAlignment="Left" IsEnabled="True" />
                                    <TextBox x:Name="txtGenerateVector" Background="#FFFFFFFF" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="188" Text="" KeyDown="textClip_KeyDown" TextChanged="txtDatabaseConnectionText_textChanged" IsEnabled="False" />
                                </StackPanel>
                                <StackPanel Margin="0 0 15 15">
                                    <Label x:Name="label4" Content="Pass Phrase" HorizontalAlignment="Left" IsEnabled="true"  VerticalAlignment="Top" />
                                    <TextBox x:Name="txtPassphrase" HorizontalAlignment="Left" VerticalAlignment="Top" Width="188" KeyDown="textClip_KeyDown" TextChanged="txtDatabaseConnectionText_textChanged" IsEnabled="False" />
                                </StackPanel>
                                <StackPanel Margin="0 0 15 15">
                                    <Label x:Name="label5" Content="Salt Value" HorizontalAlignment="Left" IsEnabled="true"  VerticalAlignment="Top" />
                                    <TextBox x:Name="txtSaltValue" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="188" Text="" KeyDown="textClip_KeyDown" TextChanged="txtDatabaseConnectionText_textChanged" IsEnabled="False" />
                                </StackPanel>
                                <StackPanel Margin="0 0 15 0">
                                    <Label x:Name="label3" Content="Password Salt" HorizontalAlignment="Left"  VerticalAlignment="Top" IsEnabled="True" />
                                    <TextBox x:Name="txtSaltKey2" HorizontalAlignment="Left" Width="188" ToolTip="Salt key for one-way password hashing of user password at log on.  This key is used to create the salt which is used to salt the pasword hash." UseLayoutRounding="True" VerticalAlignment="Top" KeyDown="textClip_KeyDown" TextChanged="txtDatabaseConnectionText_textChanged" IsEnabled="False" />
                                </StackPanel>
                            </WrapPanel>

                            <StackPanel x:Name="grdKeysOutput" Visibility="Visible" Margin="0 10 0 0">


                                <!--</StackPanel>-->
                                <!--<StackPanel>
                <Image Source="Fatcow-Farm-Fresh-Page-copy.ico" Height="24" Width="24" Stretch="None"     />
            </StackPanel>-->
                                <!--<StackPanel x:Name="spKeysOutput" >-->
                                <StackPanel>
                                    <Label x:Name="label1" Content="Output" />
                                </StackPanel>
                                <StackPanel>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition Width="85" />
                                        </Grid.ColumnDefinitions>
                                        <TextBox Grid.Column="0" TextWrapping="Wrap" IsEnabled="false" Height="100" x:Name="textClip" TextChanged="textClip_TextChanged" FontFamily="Courier New" />
                                        <Button Grid.Column="1" IsEnabled="false" x:Name="buttonCopy" Margin="15 0 0 0" Click="buttonCopy_Click" ToolTip="Copy to clipboard " VerticalAlignment="Top" Content="Copy" Width="70" />
                                    </Grid>
                                </StackPanel>
                                <WrapPanel Orientation="Horizontal" Margin="0 15 0 0">
                                    <Button Margin="0 0 15 15" Content="Update web.config file" IsEnabled="False"  HorizontalAlignment="Left"  x:Name="buttonUpdateKeys" VerticalAlignment="Top" Width="188" Click="buttonUpdateKesy_Click" ToolTip="Displays file dialog to select web.config file and loads keys from web.config" />
                                    <Button x:Name="buttonNew" IsEnabled="False" Content="Generate new keys"  HorizontalAlignment="Left"  VerticalAlignment="Top" Width="188" Click="buttonNew_Click" ToolTip="Generates new keys to used for Encryption/Decryption."  RenderTransformOrigin="0.369,0.282" />
                                </WrapPanel>

                            </StackPanel>
                        </StackPanel>


                        <!--</Grid>-->

                    </GroupBox>
                </StackPanel>
                <StackPanel Margin="0 0 0 10">
                    <GroupBox Style="{StaticResource EncryptionDecryptionGrpBox}" Height="Auto" x:Name="grpEncDec"  Visibility="Visible" Margin="28,20,24,0" >
                        <GroupBox.Header>
                            <Label Foreground="#333333" FontSize="18" FontWeight="Bold" Content="Encryption/Decryption"/>
                        </GroupBox.Header>
                        <StackPanel  Margin="13,10,13, 10" >
                            <Label Name="label2" Content="Free Text" HorizontalAlignment="Left" VerticalAlignment="Top"  />
                            <TextBox Margin="0 0 85 0" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxHeight="60"  Name="txtDatabaseConnectionText" VerticalAlignment="Top" />

                            <StackPanel Orientation="Horizontal" Margin="0 15 0 10">
                                <Button Name="buttonEncrypt" Margin="0 0 15 0" IsEnabled="false" Content="Encrypt"  HorizontalAlignment="Left" VerticalAlignment="Top" Width="82" Click="buttonExist_Click" />
                                <Button Content="Decrypt"  IsEnabled="false" HorizontalAlignment="Left" Name="buttonDecrypt" VerticalAlignment="Top" Width="94" Click="buttonDecrypt_Click" />
                            </StackPanel>
                            <Label Content="Output" HorizontalAlignment="Left" Name="label8" VerticalAlignment="Top" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="85" />
                                </Grid.ColumnDefinitions>
                                <TextBox Grid.Column="0" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="77" Name="textBox1" IsReadOnly="True" VerticalAlignment="Top" />
                                <Button Grid.Column="1" Margin="15 0 0 0" x:Name="CopyOutputED" Content="Copy"  IsEnabled="False" ToolTip="Copy to clipboard " VerticalAlignment="Top" Width="70" Click="button1_Click" RenderTransformOrigin="2.027,0.465" />
                                <Button Grid.Column="1" Margin="15 40 0 0" x:Name="ClearText" Content="Clear"  IsEnabled="False" ToolTip="Copy to clipboard " VerticalAlignment="Top" Width="70" Click="ClearText_Click" RenderTransformOrigin="2.027,0.465" />
                            </Grid>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>

                <StackPanel Background="#123b6a" Height="20" Margin="28,-10,24,0">
                    <StackPanel Orientation="Horizontal" Margin="15 -6 15 0">
                        <StackPanel x:Name="LangandVer"  HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 0 0 0">
                            <StackPanel Orientation="Horizontal" Margin="0 0 5 0">
                                <TextBlock x:Name="txtVersion" Margin="0 8 3 0" Foreground="#8eafd5"><Run Text="VERSION:"/></TextBlock>
                                <TextBlock Foreground="#8eafd5" Margin="0 8 3 0" x:Name="tsslVersion"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>


            </StackPanel>
        </ScrollViewer>
    </DockPanel>
</Window>         